---@class RedRob.RunState : RedRob.StateBase
local RunState = RedRob.CreateClass("RunState","StateBase")

function RunState:Init()
end
function RunState:OnEnter()
    self:OnReEnter()
end
function RunState:OnReEnter()
    if not self.data then
        return
    end
    self.curPos = Vector3.GetCacheVec()
    local isLeft = self.data.moveDir.x < 0
    self.actor:SetDir(isLeft)
end
function RunState:OnExit()
    if self.curPos then
        Vector3.ReturnToPool(self.curPos)
    end
    self.curPos = nil
end
function RunState:Update(dt)
    self:PlayAction("move",true)
    --[[if not self.data then
        return
    end
    local p = self.actor:GetPos()
    self.curPos:SetV(self.data.moveDir):Mul(self.actor:GetSpeed()*dt)
    self.curPos:Add(p)
    self.actor:SetPosByVec(self.curPos)]]
end